package example.basic;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mvel.MVEL;

public class PropertyExample {
	
	private static Log log = LogFactory.getLog(PropertyExample.class);
	
	public static void main(String[] args) {
		String expression1 = "'The name of user is    : ' + user.name + '.'";
		String expression2 = "'The password of user is: ' + user.password + '.'";
		
		User user = new User();
		user.setName("kongxx");
		user.setPassword("12345678");
		
		Map vars = new HashMap();
		vars.put("user", user);

		log.info(MVEL.eval(expression1, vars));
		log.info(MVEL.eval(expression2, vars));
	}
}
